/**
 * Created by wxb on 2016/10/3.
 */
/**
 * @author a.demeshko
 * created on 3/1/16
 */
(function () {
  'use strict';

  angular.module('BlurAdmin')
    .service('pubService', function () {
      this.countWords = function(str) {
        var matches = str.match(/[\u00ff-\uffff]|\S+/g);
        return matches ? matches.length : 0;
      }
      this.addParamsToUrl = function (url, query) {
        Object.keys(query).forEach(function (key) {
          if (query[key]) {
            url = url + ((url.indexOf('?') < 0) ? '?' : '&') + key + '=' + query[key];
          }
        });

        return url;
      }
    })



  ;



})();